home *** CD-ROM | disk | FTP | other *** search
- import java.awt.*;
- import symantec.itools.awt.util.dialog.DialogBox;
- import symantec.itools.awt.util.ProgressBar;
-
- public class ProgressDialog extends DialogBox
- {
- public ProgressDialog(Frame parent, String title, String button, boolean modal)
- {
- super(parent, title, modal);
-
- // This code is automatically generated by Visual Cafe when you add
- // components to the visual environment. It instantiates and initializes
- // the components. To modify the code, only use code syntax that matches
- // what Visual Cafe can generate, or Visual Cafe may be unable to back
- // parse your Java file into its visual environment.
- //{{INIT_CONTROLS
- setLayout(new FlowLayout());
- setSize(270, 73);
- bar = new ProgressBar();
- bar.setBounds(52, 25, 121, 23);
- add(bar);
- //}}
-
- if (button != null)
- {
- okButton = new Button(button);
- okButton.setBounds(178, 22, 47, 29);
- add(okButton);
- }
- }
-
- public ProgressDialog(Frame parent)
- {
- this(parent, true);
- }
-
- public ProgressDialog(Frame parent, boolean modal)
- {
- this(parent, "Progress", modal);
- }
-
- public ProgressDialog(Frame parent, String title, boolean modal)
- {
- this(parent, title, "Cancel", modal);
- }
-
- public void setProgress(int amount)
- {
- if (bar != null)
- {
- try
- {
- bar.setProgressPercent(amount);
- }
- catch (java.beans.PropertyVetoException pve)
- {
- }
- }
- }
-
- public void addNotify()
- {
- // Record the size of the window prior to calling parents addNotify.
- Dimension d = getSize();
- super.addNotify();
-
- if (fComponentsAdjusted)
- return;
-
- // Adjust components according to the insets
- Insets insets = getInsets();
- setSize(insets.left + insets.right + d.width, insets.top + insets.bottom + d.height);
- Component components[] = getComponents();
- for (int i = 0; i < components.length; i++)
- {
- Point p = components[i].getLocation();
- p.translate(insets.left, insets.top);
- components[i].setLocation(p);
- }
- fComponentsAdjusted = true;
- }
-
- // Used for addNotify check.
- boolean fComponentsAdjusted = false;
-
- //{{DECLARE_CONTROLS
- ProgressBar bar;
- //}}
- }
-